/* 导入全局样式 */
@import url('./common/header.css');

/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

/* 容器样式 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    padding-bottom: 80px;
}

/* 商品列表网格 */
.goods-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.5rem;
    padding: 1rem;
    justify-items: center;
}

/* 商品卡片样式 */
.goods-item {
    width: 100%;
    max-width: 280px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
}

.goods-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

/* 商品图片容器 */
.product-image-container {
    width: 100%;
    height: 220px;
    overflow: hidden;
    position: relative;
    background: #f8f9fa;
}

/* 商品图片 */
.product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.goods-item:hover .product-image {
    transform: scale(1.05);
}

/* 商品信息 */
.product-info {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

/* 商品名称 */
.product-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.4;
    min-height: 3em;
}

/* 商品描述 */
.product-description {
    font-size: 0.9rem;
    color: #666;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.5;
    flex: 1;
}

/* 商品底部信息 */
.product-footer {
    margin-top: auto;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 0.75rem;
}

/* 价格和库存 */
.product-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: #e74c3c;
    margin: 0;
    display: flex;
    align-items: baseline;
    gap: 0.2rem;
}

.product-price::before {
    content: '¥';
    font-size: 0.9em;
    opacity: 0.9;
}

.product-stock {
    font-size: 0.85rem;
    color: #666;
    margin: 0;
    grid-column: 1 / -1;
}

/* 加入购物车按钮 */
.add-to-cart {
    background: linear-gradient(135deg, #4a90e2, #357abd);
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    white-space: nowrap;
}

.add-to-cart i {
    font-size: 0.9em;
}

.add-to-cart:hover {
    background: linear-gradient(135deg, #357abd, #2868a9);
    transform: translateY(-2px);
}

.add-to-cart:active {
    transform: translateY(0);
}

.add-to-cart:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* 购物车结算栏 */
.checkout-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    padding: 1rem;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: center;
    z-index: 100;
}

.checkout-bar .cart-link {
    background: linear-gradient(135deg, #4a90e2, #357abd);
    color: white;
    text-decoration: none;
    padding: 0.8rem 2rem;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.checkout-bar .cart-link:hover {
    background: linear-gradient(135deg, #357abd, #2868a9);
    transform: translateY(-2px);
}

.checkout-bar .cart-link:active {
    transform: translateY(0);
}

.checkout-bar .cart-link i {
    font-size: 1.1em;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .goods-list {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 1rem;
        padding: 0.5rem;
    }

    .goods-item {
        max-width: none;
    }

    .product-image-container {
        height: 180px;
    }

    .product-info {
        padding: 0.75rem;
        gap: 0.4rem;
    }

    .product-name {
        font-size: 1rem;
        min-height: 2.8em;
    }

    .product-description {
        font-size: 0.85rem;
        -webkit-line-clamp: 2;
    }

    .product-footer {
        padding-top: 0.5rem;
        gap: 0.5rem;
    }

    .product-price {
        font-size: 1.1rem;
    }

    .add-to-cart {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }

    .checkout-bar {
        padding: 0.75rem;
    }

    .checkout-bar .cart-link {
        padding: 0.6rem 1.5rem;
        font-size: 0.95rem;
    }
}

/* 加载动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.goods-item {
    animation: fadeIn 0.3s ease-out;
}
